import nodemailer from "nodemailer"

const transporter = nodemailer.createTransport({
  host: "smtpdm.aliyun.com",
  port: 465,
  secure: true,
  auth: {
    user: "kenny@smtp.868618.com", // user name
    pass: "YouJian123", // password
  },
})

type IType = {
  from?: string
  subject: string
  text: string
}

export default ({ from = "kenny", subject, text }: IType) =>
  transporter.sendMail({
    from: `"${from}" <kenny@smtp.868618.com>`,
    to: "shanjiandeshu@163.com",
    subject,
    text,
  })
